//
//  RouteCell.m
//  Follow Me
//
//  Created by apple on 2017/4/11.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "RouteCell.h"
#import "Routes+CoreDataClass.h"
#import "Users+CoreDataClass.h"
#import "MainModel.h"
#import "DetailOfRouteViewController.h"
@implementation RouteCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.RouteCellView.layer.cornerRadius = 8;
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    

    // Configure the view for the selected state
}

- (void)ConfigRouteCell:(Routes *)dic
{
    Routes *route1 = dic;
    self.RouteCellUserName.text = route1.user.userName;
    self.RouteCellRouteName.text = route1.routeName;
//    NSLog(@"%@",route1.user);
    //nsdate转换成nsstring
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy/MM/dd"];
    self.RouteCellDate.text = [dateFormatter stringFromDate:route1.routeDate];
    
    self.RouteCellRouteDescription.text =route1.routeDescription;
    self.RouteCellUserLogo.layer.cornerRadius = 21;
    self.RouteCellUserLogo.layer.masksToBounds = YES;
    self.RouteCellUserLogo.image = [UIImage imageWithData:route1.user.userPicture];
    NSData *tempImage = route1.introducePicture;
    UIImage *tempIntroduce = [UIImage imageWithData:tempImage];
    NSData *tempImage1 = UIImageJPEGRepresentation(tempIntroduce, 0.1);
    self.RouteCellUIImage.image = [UIImage imageWithData:tempImage1];
}


@end
